package com.yishe.controller.login;

import com.yishe.biz.login.LoginBiz;
import com.yishe.config.ObjectRestResponse;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.Map;

/**
 * @author : chusifeng
 * @version :
 * @date :Create in 2021/4/14 11:00
 * @description: 登录管理
 * @package com.yishe.controller.wx
 * @className LoginController
 */
@RestController
@Slf4j
@RequestMapping("/login/login")
public class LoginController {
    private static final String TITLE ="登录模块|";
    @Resource
    private LoginBiz loginBiz;

    @PostMapping(value = "ys_login")
    public ObjectRestResponse login(@RequestBody Map<String, String > param) {
        log.info(TITLE+"教员登录"+ param);
        ObjectRestResponse restResponse = new ObjectRestResponse();
        try {
            restResponse = loginBiz.yslogin(param);
        } catch (Exception e) {
            log.error("教员登录出错！"+e);
            restResponse.setErrorMsg(e.getMessage());
        }
        return restResponse;
    }
    @PostMapping(value = "wx_login")
    public ObjectRestResponse wxlogin(@RequestBody Map<String, String > param) {
        log.info(TITLE+"用户系统登录"+ param);
        ObjectRestResponse restResponse = new ObjectRestResponse();
        try {
            restResponse = loginBiz.wxlogin(param);
        } catch (Exception e) {
            log.error("用户系统登录出错！"+e);
            restResponse.setErrorMsg(e.getMessage());
        }
        return restResponse;
    }

}
